package com.sy.auto.interceptor;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "token.web")
public class ValidationProperties {
    private final String[] DEFAULT_PATH_PATTERNS = {"/**"};//默认拦截所有请求
    private final String[] DEFAULT_EXCLUDE_PATH_PATTERNS = {"/login"};//默认不拦截的请求
    String[] pathPatterns;//默认拦截的路径
    String[] excludePathPatterns;//不拦截的路径


    public String[] getPathPatterns() {
        if (null == pathPatterns || pathPatterns.length == 0) {
            return DEFAULT_PATH_PATTERNS;
        }
        return pathPatterns;
    }

    public void setPathPatterns(String[] pathPatterns) {
        this.pathPatterns = pathPatterns;
    }

    public String[] getExcludePathPatterns() {
        if (null == excludePathPatterns || excludePathPatterns.length == 0) {
            return DEFAULT_EXCLUDE_PATH_PATTERNS;
        }
        return excludePathPatterns;
    }

    public void setExcludePathPatterns(String[] excludePathPatterns) {
        this.excludePathPatterns = excludePathPatterns;
    }
}
